/*
 * lcd-api.h
 *
 *  Created on: 2010/04/09
 *      Author: debian
 */

#ifndef LCDAPI_H_
#define LCDAPI_H_

#ifdef __USE_CMSIS
#include "LPC11xx.h"
#endif

/*------- LCD control port --------*/
/*use port3 for lcd control port*/
#define LCD_CONTROL_PORT PORT3
/* lcd chip select pin*/
#define LCD_CS 0
/* lcd write pin */
#define LCD_WR 1
/* lcd reset pin*/
#define LCD_RS 2
/* lcd read pin */
#define LCD_RD 3

/*------- LCD data port -------*/
/*
 *  1. LCD DB0 to DB11 pins are connected with LPC1114 PIO2_0 to PIO2_11
 *  2. LCD DB12 to DB15 are connected with LPC1114 PIO1_0 to PIO1_3
 *
 */
#define LCD_DATA_LOW_PORT PORT2
#define LCD_DATA_LOW_PORT_MSB (11)
#define LCD_DATA_LOW_PORT_LSB (0)
#define LCD_DATA_HIGH_PORT PORT1
#define LCD_DATA_HIGH_PORT_MSB (3)
#define LCD_DATA_HIGH_PORT_LSB (0)

#define PIN_ON (1)		// Level to set pin to turn on
#define PIN_OFF (0)		// Level to set pin to turn off

#define red			(0xf800)
#define green		(0x07e0)
#define blue		(0x001f)
#define black		(0x0000)
#define white		(0xffff)
#define gray		(0x8c51)
#define yellow		(0xFFE0)
#define cyan		(0x07FF)
#define purple		(0xF81F)

static uint16_t colorc[]={red,green,blue,black,white,gray,yellow,cyan,purple};

#define TIMER1 (1) //using timer 1 for delay

void init_LCD(void);
void Display(uint16_t c1,uint16_t x,uint16_t y);


void Delayms(uint16_t i);
void Delay(uint16_t i);

#endif /* LCDAPI_H_ */
